"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmallHandler = void 0;
const Big_1 = require("../core/Big");
const GameUtils_1 = __importDefault(require("../GameUtils"));
const Config_1 = require("../../Config");
const BaseHandler_1 = require("./BaseHandler");
class SmallHandler extends BaseHandler_1.BaseHandler {
    /** 小子出大 */
    smallBornBig(data, player) {
        //行动力消耗
        this.handlerMgr.spendAction(player, Config_1.Config.COST_BORN_BIG);
        //出大
        let startPoint = this.gameMgr.map_point.get(data.start);
        let endPoint = this.gameMgr.map_point.get(data.end);
        let small = startPoint.small;
        let oldBig = endPoint.big;
        if (oldBig != null) {
            this.handlerMgr.showToast(player, "出大失败");
            oldBig.deleteState(Big_1.BigState.HIDE);
            this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("play_effect", { "effect": "big_die", "point_id": endPoint.id, "username": player.username }));
            return;
        }
        let big = new Big_1.Big();
        big.init(this.gameMgr, small.player, endPoint, small, null);
        this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("born_big", { "big": big.toObj() }));
    }
}
exports.SmallHandler = SmallHandler;
